#ifndef _CKSUM_H_
#define _CKSUM_H_

#include "mytypes.h"
#include "mydll.h"

#if defined(__cplusplus)
extern "C"
{
#endif

tUInt32 cksum (void *inputbuf, tUInt32 inputbuflen);

/*
  Compute the partial CRC32 checksum of a buffer. 
  This function is used when we cannot get all data at once 
  underhand. So we have to compute the CRC32 incrementally.

  The first time, the crc parameter should be equal 0.
  The returned value is the partial CRC32 checksum that should be
  given as crc parameter together with the next buffer. Repeat
  until the end of data is reached.
 */
tUInt32 partial_cksum(void *inputbuf, tUInt32 inputbuflen, tUInt32 partial_crc);

/*
  Call this function to get the final CRC32 value of a given file
  read by buffer increment. To do so, give the total length of the 
  data to compute the CRC32 and the partial crc computed so far.
  
 */
tUInt32 final_cksum(tUInt32 totallength, tUInt32 partial_crc);

#if defined(__cplusplus)
} /*  extern "C" */
#endif

#endif /* _CKSUM_H_ */
